package composite;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-29 18:31
 * @notify
 * @version 1.0
 */

import java.util.ArrayList;
import java.util.List;

public class Composite implements Component {

    private List<Component> childs = new ArrayList<>();

    public Composite getComposite() {
        return this;
    }

    public void addChild(Component component) {
        this.childs.add(component);
    }

    public void removeChild(int index) {
        childs.remove(index);
    }

    public List<Component> getChilds() {
        return childs;
    }
}
